<template>
  <div v-show="isLoading" class="apinner-loading">
    <div class="spinner">
      <div class="bounce1" />
      <div class="bounce2" />
      <div class="bounce3" />
    </div>
  </div>
</template>

<script lang="ts">
import { defineComponent, computed } from 'vue'
import { useStore } from 'vuex'
export default defineComponent({
  setup() {
    const store = useStore()
    const isLoading = computed(() => {
      return store.getters.setLoading
    })
    return {
      isLoading
    }
  }
})

</script>

<style lang="scss" scoped>
  .apinner-loading {
    position: fixed;
    top: 0;
    width: 100%;
    left: 0;
    z-index: 3001;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    overflow: hidden;
  }

  .spinner {
    margin: 100px auto 0;
    width: 150px;
    text-align: center;
  }

  .spinner>div {
    width: 20px;
    height: 20px;
    background-color: #00BCD4;

    border-radius: 100%;
    display: inline-block;
    -webkit-animation: bouncedelay 1.4s infinite ease-in-out;
    animation: bouncedelay 1.4s infinite ease-in-out;
    -webkit-animation-fill-mode: both;
    animation-fill-mode: both;
  }

  .spinner .bounce1 {
    -webkit-animation-delay: -0.32s;
    animation-delay: -0.32s;
  }

  .spinner .bounce2 {
    -webkit-animation-delay: -0.16s;
    animation-delay: -0.16s;
  }

  @-webkit-keyframes bouncedelay {

    0%,
    80%,
    100% {
      -webkit-transform: scale(0.0)
    }

    40% {
      -webkit-transform: scale(1.0)
    }
  }

  @keyframes bouncedelay {

    0%,
    80%,
    100% {
      transform: scale(0.0);
      -webkit-transform: scale(0.0);
    }

    40% {
      transform: scale(1.0);
      -webkit-transform: scale(1.0);
    }
  }

</style>
